#install.packages("ggplot2")
#install.packages("viridis")
#install.packages("latticeExtra")
require(ggplot2)
library(viridis)
library(latticeExtra)
library(reshape2)
#install.packages("ggsci")
library(ggsci)

### aspect eps 656 x 468
### 60 0 425 351
d<- read.csv(file="datain.csv",head=TRUE)
df<- data.frame(value=d)
##############################################################
p <- ggplot(df)+
  geom_point(aes(x= value.lnPISE, y = value.lnPICD), shape =1)+
  theme(aspect.ratio = 1)+
  geom_abline(slope=1,intercept = 0.)+
  xlab("ln PI_SE")+
  ylab("ln PI_CD")+coord_fixed()#this fixes the coordinates
p
ggsave(file = "lnPIselnPIcd.eps", plot = p, width = 6.56, height = 4.68)
###############################################################
############################  ###################################
pp<- ggplot(df, aes(sample = value.lnHCD) )+
  stat_qq() + stat_qq_line(line.p = c(0.001, 0.999)) +
  theme(aspect.ratio = 1) +
  ylab("ln H_CD") +
  xlab("Normal theoretical quantiles")+coord_fixed()#this fixes the coordinates
pp
ggsave(file = "ln_H_cd.eps", plot = pp, width = 6.56, height = 4.68)
###############################################################
pp<- ggplot(df, aes(sample = value.lnHLT) )+
  stat_qq() + stat_qq_line(line.p = c(0.25, 0.75)) +
  theme(aspect.ratio = 1) +
  ylab("ln H_LT") +
  xlab("Normal theoretical quantiles")+coord_fixed()#this fixes the coordinates
pp
ggsave(file = "ln_H_LT.eps", plot = pp, width = 6.56, height = 4.68)
###############################################################
pp<- ggplot(df, aes(sample = value.lnHCES) )+
  stat_qq() + stat_qq_line(line.p = c(0.25, 0.75)) +
  theme(aspect.ratio = 1) +
  ylab("ln H_CES") +
  xlab("Normal theoretical quantiles")+coord_fixed()#this fixes the coordinates
pp
ggsave(file = "ln_H_CES.eps", plot = pp, width = 6.56, height = 4.68)
###############################################################
pp<- ggplot(df, aes(sample = - value.lnPICES + value.lnPISE) )+
  stat_qq() + stat_qq_line(line.p = c(0.25, 0.75)) +
  theme(aspect.ratio = 1) +
  ylab("ln H_CES") +
  xlab("Normal theoretical quantiles")+coord_fixed()#this fixes the coordinates
pp
#





















##############################################################
#ggplot(df, aes(sample = value.ln_PI_SE) )+
p <- ggplot(df, aes(sample =  value.ln_PI_SE - value.ln_PI_CD) )+
  stat_qq() + stat_qq_line() +
  theme(aspect.ratio = 1) +
  ylab("ln PI(SE) - ln PI(CD)") +
  xlab("Normal theoretical quantiles")+coord_fixed()#this fixes the coordinates
p
ggsave(file = "lnpicd5.eps", plot = p, width = 6.56, height = 4.68)
##############################################################
#ggplot(df, aes(sample = value.ln_PI_SE) )+
p <- ggplot(df, aes(sample =  value.ln_PI_LT - value.ln_PI_CD) )+
  stat_qq() + stat_qq_line() +
  theme(aspect.ratio = 1) +
  ylab("ln PI(LT) - ln PI(CD)") +
  xlab("Normal theoretical quantiles")+coord_fixed()#this fixes the coordinates
p
ggsave(file = "lnpilt4.eps", plot = p, width = 6.56, height = 4.68)
##############################################################




########################################################################
ggplot(df)+
  geom_point(aes(x= value.n, y = value.ln_PI_CES ))+
  theme(aspect.ratio = 1)+
  xlab("sample")+
  ylab("CES - CD (%/y)")+coord_fixed()#this fixes the coordinates
##############################################################


########################################################################
p <- ggplot(df)+
  geom_point(aes(x= value.ln_PI_LT, y = value.ln_PI_CES ))+
  theme(aspect.ratio = 1)+
  geom_abline(slope=1,intercept = 0.)+
  xlab("ln PI (LT)")+
  ylab("ln PI (CES)")+coord_fixed()#this fixes the coordinates
p
ggsave(file = "xltyces3.eps", plot = p, width = 6.56, height = 4.68)
##############################################################
p <- ggplot(df)+
  geom_point(aes(x= value.ln_PI_LT, y = value.ln_PI_CD ))+
  theme(aspect.ratio = 1)+
  geom_abline(slope=1,intercept = 0.)+
  xlab("ln PI (LT)")+
  ylab("ln PI (CD)")+coord_fixed()#this fixes the coordinates
p
ggsave(file = "xltycd3.eps", plot = p, width = 6.56, height = 4.68)
##############################################################
p <- ggplot(df)+
  geom_point(aes(x= value.ln_PI_CD, y = value.ln_PI_CES ))+
  theme(aspect.ratio = 1)+
  geom_abline(slope=1,intercept = 0.)+
  xlab("ln PI (CD)")+
  ylab("ln PI (CES)")+coord_fixed()#this fixes the coordinates
p
ggsave(file = "xcdyces4.eps", plot = p, width = 6.56, height = 4.68)
##############################################################
p <- ggplot(df)+
  geom_point(aes(x= value.ln_PI_SE, y = value.ln_PI_CD ))+
  theme(aspect.ratio = 1)+
  geom_abline(slope=1,intercept = 0.)+
  xlab("ln PI (SE)")+
  ylab("ln PI (CD)")+coord_fixed()#this fixes the coordinates
p
ggsave(file = "xseycd4.eps", plot = p, width = 6.56, height = 4.68)
##############################################################

p












